/*
package com.zh.work.config;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zh.work.entity.channel.QrCodeMerchEntity;
import com.zh.work.entity.merch.MerchInfoEntity;
import com.zh.work.service.platform.channel.QrCodeMerchService;
import com.zh.work.service.platform.merch.MerchInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static com.zh.work.util.plateform.ServiceUtil.creatMerchantNo;

*/
/**
 * code is far away from bug with the animal protecting
 * ┏┓　　　┏┓
 * ┏┛┻━━━┛┻┓
 * ┃　　　　　　　┃
 * ┃　　　━　　　┃
 * ┃　┳┛　┗┳　┃
 * ┃　　　　　　　┃
 * ┃　　　┻　　　┃
 * ┃　　　　　　　┃
 * ┗━┓　　　┏━┛
 * 　　┃　　　┃神兽保佑
 * 　　┃　　　┃代码无BUG！
 * 　　┃　　　┗━━━┓
 * 　　┃　　　　　　　┣┓
 * 　　┃　　　　　　　┏┛
 * 　　┗┓┓┏━┳┓┏┛
 * 　　　┃┫┫　┃┫┫
 * 　　　┗┻┛　┗┻┛
 *
 * @Description: 消息监听器
 * @Author: Li.HuiNeng
 * @Create in: 2019-10-29 10:39
 * @Version: 1.0.1
 *//*

//@Component
public class RabbitMQListener {
    private static final Logger log = LoggerFactory.getLogger(RabbitMQListener.class);

    @Autowired
    private MerchInfoService service;

    @Autowired
    private QrCodeMerchService qService;

    @RabbitHandler
    @RabbitListener(queues = "one_cert_add_mq")
    public void process(Message message) {
        String msg = new String(message.getBody(), StandardCharsets.UTF_8);
        HashMap map = JSON.parseObject(msg, HashMap.class);
        log.info("审核成功回调 => 回调信息:{}", map);
        String mrcId = (String) map.get("MERC_ID");
        MerchInfoEntity entity = new MerchInfoEntity();
        QrCodeMerchEntity qEntity = new QrCodeMerchEntity();
        entity = service.getOne(new LambdaQueryWrapper<MerchInfoEntity>().eq(MerchInfoEntity::getMerchNo, mrcId));
        if (Objects.nonNull(entity)) {
            String regEx="[^0-9]";
            Pattern p = Pattern.compile(regEx);
            Matcher m = p.matcher(entity.getProvinceCity());
            qEntity.setBranchNo(entity.getBranchNo());
            qEntity.setTermNo(entity.getTermNo());
            qEntity.setStatus((Integer) map.get("AUD_STS"));
            qEntity.setMerchNo(entity.getMerchNo());
            qEntity.setMerchName(entity.getMerchName());
            qEntity.setSettleType(entity.getSettleTypeM());
            int pType = 0;
            if (map.get("ALIPAY_FLAG").equals("0")) {
                pType += 1;
            } else if (map.get(map.get("WECHAT_FLAG")).equals("0")) {
                pType += 2;
            }
            qEntity.setChannelCode("DianYinTong");
            qEntity.setPayType(pType);
            qEntity.setScanType(7);
            qEntity.setChannelMerchName(entity.getMerchName());
            boolean b = qEntity.insert();
            log.info("插入二维码交易商户信息,结果：{}", b);
        }

    }
}
*/
